﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.Interface
{
    public interface IBaseRepository<T> where T : class
    {
        /// <summary>
        /// 添加(单)
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Task<int> Add(T entity);

        /// <summary>
        /// 真删(单)
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public Task<int> Del(T entitys);

        /// <summary>
        /// 修改(单)
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Task<int> Upd(T entity);

        /// <summary>
        /// 查询(单)
        /// </summary>
        public Task<T> GetOne(int entity);

        /// <summary>
        ///批量添加
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public Task<int> AddRange(List<T> entitys);

        /// <summary>
        /// 批量真删
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Task<int> DelRange(List<T> entity);

        /// <summary>
        /// 批量修改(批量逻辑删)
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        public Task<int> UpdRange(List<T> entitys);

        /// <summary>
        /// 查询所有
        /// </summary>
        /// <returns></returns>
        public Task<IQueryable<T>> GetAllAsync();

        /// <summary>
        /// 查询所有
        /// </summary>
        /// <returns></returns>
        public IQueryable<T> GetAll();

    }
}
